package com.fengyunhe.manager.dao.entity;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * 功能：
 * 作者： yangyan
 * 时间： 2014/11/3 .
 */
@Entity
@Table(name = "admin_log")
public class AdminLogEntity {
    private String logId;
    private String moduleName;
    private String ip;
    private String logContent;
    private Timestamp createdAt;
    private Integer createdByUserId;
    private String createdByRealName;
    private Integer returnSuccess;
    private String args;
    private String msgText;
    private String errorText;

    @GenericGenerator(name = "generator", strategy = "uuid.hex")
    @GeneratedValue(generator = "generator")
    @Id
    @Column(name = "log_id", nullable = false, insertable = true, updatable = true, length = 36)
    public String getLogId() {
        return logId;
    }

    public void setLogId(String logId) {
        this.logId = logId;
    }

    @Basic
    @Column(name = "module_name", nullable = true, insertable = true, updatable = true, length = 60)
    public String getModuleName() {
        return moduleName;
    }

    public void setModuleName(String moduleName) {
        this.moduleName = moduleName;
    }

    @Basic
    @Column(name = "ip", nullable = true, insertable = true, updatable = true, length = 15)
    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    @Basic
    @Column(name = "log_content", nullable = true, insertable = true, updatable = true, length = 2147483647)
    public String getLogContent() {
        return logContent;
    }

    public void setLogContent(String logContent) {
        this.logContent = logContent;
    }

    @Basic
    @Column(name = "created_at", nullable = true, insertable = true, updatable = true)
    public Timestamp getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.createdAt = createdAt;
    }

    @Basic
    @Column(name = "created_by_user_id", nullable = true, insertable = true, updatable = true)
    public Integer getCreatedByUserId() {
        return createdByUserId;
    }

    public void setCreatedByUserId(Integer createdByUserId) {
        this.createdByUserId = createdByUserId;
    }

    @Basic
    @Column(name = "created_by_real_name", nullable = true, insertable = true, updatable = true, length = 36)
    public String getCreatedByRealName() {
        return createdByRealName;
    }

    public void setCreatedByRealName(String createdByRealName) {
        this.createdByRealName = createdByRealName;
    }

    @Basic
    @Column(name = "return_success", nullable = true, insertable = true, updatable = true)
    public Integer getReturnSuccess() {
        return returnSuccess;
    }

    public void setReturnSuccess(Integer returnSuccess) {
        this.returnSuccess = returnSuccess;
    }

    @Basic
    @Column(name = "args", nullable = true, insertable = true, updatable = true, length = 65535)
    public String getArgs() {
        return args;
    }

    public void setArgs(String args) {
        this.args = args;
    }

    @Basic
    @Column(name = "msg_text", nullable = true, insertable = true, updatable = true, length = 65535)
    public String getMsgText() {
        return msgText;
    }

    public void setMsgText(String msgText) {
        this.msgText = msgText;
    }

    @Basic
    @Column(name = "error_text", nullable = true, insertable = true, updatable = true, length = 65535)
    public String getErrorText() {
        return errorText;
    }

    public void setErrorText(String errorText) {
        this.errorText = errorText;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AdminLogEntity that = (AdminLogEntity) o;

        if (args != null ? !args.equals(that.args) : that.args != null) return false;
        if (createdAt != null ? !createdAt.equals(that.createdAt) : that.createdAt != null) return false;
        if (createdByRealName != null ? !createdByRealName.equals(that.createdByRealName) : that.createdByRealName != null)
            return false;
        if (createdByUserId != null ? !createdByUserId.equals(that.createdByUserId) : that.createdByUserId != null)
            return false;
        if (errorText != null ? !errorText.equals(that.errorText) : that.errorText != null) return false;
        if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
        if (logContent != null ? !logContent.equals(that.logContent) : that.logContent != null) return false;
        if (logId != null ? !logId.equals(that.logId) : that.logId != null) return false;
        if (moduleName != null ? !moduleName.equals(that.moduleName) : that.moduleName != null) return false;
        if (msgText != null ? !msgText.equals(that.msgText) : that.msgText != null) return false;
        if (returnSuccess != null ? !returnSuccess.equals(that.returnSuccess) : that.returnSuccess != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = logId != null ? logId.hashCode() : 0;
        result = 31 * result + (moduleName != null ? moduleName.hashCode() : 0);
        result = 31 * result + (ip != null ? ip.hashCode() : 0);
        result = 31 * result + (logContent != null ? logContent.hashCode() : 0);
        result = 31 * result + (createdAt != null ? createdAt.hashCode() : 0);
        result = 31 * result + (createdByUserId != null ? createdByUserId.hashCode() : 0);
        result = 31 * result + (createdByRealName != null ? createdByRealName.hashCode() : 0);
        result = 31 * result + (returnSuccess != null ? returnSuccess.hashCode() : 0);
        result = 31 * result + (args != null ? args.hashCode() : 0);
        result = 31 * result + (msgText != null ? msgText.hashCode() : 0);
        result = 31 * result + (errorText != null ? errorText.hashCode() : 0);
        return result;
    }
}
